<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>01CMS 安装程序</title>
<link href="{:$smarty.const.PUBLIC_DIR}/common/style/admin.css" rel="stylesheet" type="text/css" />
<style type="text/css">
h1 span{ color:#999;}
ul{padding:2px 0;}
li{color:#333;padding:3px 0;}
.name{ width:90px; background:#fcfcfc;}
.ok{font-weight:bold; color:#090;}
.warning{ font-weight:bold; color:#F00;}
.notice{ font-weight:bold; color:#FC0;}
</style>
</head>
<body>
<div class="wrapper">
  <div class="title shadow titleBg">
    <table width="100%" border="0" cellspacing="1">
      <tr>
        <td><h1> 01CMS 安装程序 => <span>安装检测 → </span>安装设定<span> → 安装完成</span></h1></td>
      </tr>
    </table>
  </div> 

  <div class="content shadow textL">
    <form>
	<table width="100%" border="0" cellspacing="1">
      <tr class="titleBg">
        <th colspan="2" class="textL">
          安装设定
        </th>
      </tr>
      <tr>
        <td class="textR name"> 数据库主机：</td>
        <td class="textL"><input type="text" name="hostname" id="hostname" value="localhost" size="20" class="posted check" /></td>
      </tr>
      <tr>
        <td class="textR name"> 数据库用户：</td>
        <td class="textL"><input type="text" name="username" id="username" value="root" size="20" class="posted check" /></td>
      </tr>
      <tr>
        <td class="textR name"> 数据库密码：</td>
        <td class="textL"><input type="text" name="password" id="password" value="" size="20" class="posted check" /> 
        <span id="checkConnect"><span></td>
      </tr>
      <tr>
        <td class="textR name"> 数据库名称：</td>
        <td class="textL"><input type="text" name="database" id="database" value="01cms" size="20" class="posted check" /> 
        <span id="checkDatabase"><span>
        </td>
      </tr>
      <tr>
        <td class="textR name"> 数据表前缀：</td>
        <td class="textL"><input type="text" name="prefix" value="01cms_" size="20" class="posted check" /></td>
      </tr>
      <tr>
        <td class="textR name"> 后台管理用户：</td>
        <td class="textL"><input type="text" name="adminUsername" value="admin" size="20" class="posted check" /></td>
      </tr>
      <tr>
        <td class="textR name"> 后台用户密码：</td>
        <td class="textL"><input type="text" name="adminPassword" value="admin" size="20" class="posted check" /></td>
      </tr>
      <tr>
        <td class="textR name">&nbsp;</td>
        <td class="textL"><input type="submit" value="确定安装" /> 
        <input type="button" name="next" onclick="document.location.href='{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/1';return false;" value="返回" /></td>
      </tr>
    </table>
	</form>
  </div> 
  
</div>
<link href="{:$smarty.const.PUBLIC_DIR}/common/style/ui.all.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.core.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.draggable.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/ui.dialog.js"></script>
<script language="javascript" type="text/javascript" src="{:$smarty.const.PUBLIC_DIR}/common/js/jquery.post.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
	$("form").post({
		sendUrl:'{:$smarty.const.BOOT_URL}/{:$i->c}/install',
		goUrl:'{:$smarty.const.BOOT_URL}/{:$i->c}/{:$i->m}/3',
		stayTime:4
	});
	
	$("#hostname,#username,#password").blur(function(){
		$.ajax({
			type : 'post',
			dataType : 'json',
			data : "hostname="+$("#hostname").val()+"&username="+$("#username").val()+"&password="+$("#password").val(),
			url : '{:$smarty.const.BOOT_URL}/{:$i->c}/check/connect',
			success : function(response) 
			{
				
				if (response.success)
				{
					$("#checkConnect").html('［√］'+response.message);
					$("#checkConnect").removeClass("warning");
					$("#checkConnect").addClass("ok");
				}
				else
				{
					$("#checkConnect").html('［×］'+response.message);
					$("#checkConnect").removeClass("ok");
					$("#checkConnect").addClass("warning");
				}
			}
		});				 
	});
	
	$("#database").blur(function(){
		$.ajax({
			type : 'post',
			dataType : 'json',
			data : "hostname="+$("#hostname").val()+"&username="+$("#username").val()+"&password="+$("#password").val()+"&database="+$("#database").val(),
			url : '{:$smarty.const.BOOT_URL}/{:$i->c}/check/database',
			success : function(response) 
			{
				
				if (response.success)
				{
					$("#checkDatabase").html('［√］'+response.message);
					$("#checkDatabase").removeClass("warning");
					$("#checkDatabase").addClass("ok");
				}
				else
				{
					$("#checkDatabase").html('［×］'+response.message);
					$("#checkDatabase").removeClass("ok");
					$("#checkDatabase").addClass("warning");
				}
			}
		});				 
	});
});
</script>
</body>
</html>
